package top.frsf.object.plant;

import lombok.extern.slf4j.Slf4j;
import top.frsf.constants.ImageConstant;
import top.frsf.enums.BulletTypeEnum;

import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;

/**
 * 寒冰射手
 *
 * @author He Kuntao
 * @since 2025/8/4 15:25
 */
@Slf4j
public class SnowPea extends PlantObject {

    private static final Image[] imageList = new Image[15];

    static {
        try {
            for (int i = 0; i < imageList.length; i++) {
                String imageUrl = String.format(ImageConstant.Plant.SNOW_PEA, i);
                imageList[i] = ImageIO.read(new File(imageUrl));
            }
        } catch (Exception e) {
            log.error("图片加载失败", e);
            throw new RuntimeException(e);
        }
    }


    public SnowPea(int x, int y) {
        super(ImageConstant.Plant.SNOW_PEA, x, y, 70, 70, 50, BulletTypeEnum.SNOW_PEA_BULLET);
        addAnimation(ImageConstant.Plant.SNOW_PEA, imageList);
        switchAnimation(ImageConstant.Plant.SNOW_PEA, 100, true);
    }

}
